(when (>= emacs-major-version 24)
  (require 'package)
  (setq package-archives '(
                           ("gnu"   . "http://elpa.emacs-china.org/gnu/")
                           ("melpa" . "http://elpa.emacs-china.org/melpa/")
                           ("org"   . "http://elpa.emacs-china.org/org/"))))
 ;;  (add-to-list 'package-archives '("popkit" . "http://elpa.popkit.org/packages/"))
(require 'cl)

(defvar damacs/damacs-packages '(
                                 ;;
                                 use-package
                                 pyim
                                 better-defaults
                                 ;;
                                 company
                                 company-jedi
                                 jedi-core
                                 yasnippet
                                 magit
                                 json
                                 flycheck
                                 ;;
                                 ob-ipython
                                 ob-cypher
                                 org-bullets
                                 htmlize
                                 ;;
                                 all-the-icons
                                 nyan-mode
                                 hl-todo
                                 hlinum
                                 highlight-parentheses
                                 pretty-symbols
                                 rainbow-mode
                                 window-numbering
                                 which-key
                                 solarized-theme
                                 doom-modeline
                                 posframe
                                 ;;
                                 ))

(defun damacs/damacs-packages-install ()
  (loop for pkg in damacs/damacs-packages
          when (not (package-installed-p pkg)) do (return nil)
          finally (return t)))

(unless (damacs/damacs-packages-install)
  (message "%s" "Refreshing package database...")
  (package-refresh-contents)
  (dolist (pkg damacs/damacs-packages)
    (when (not (package-installed-p pkg))
      (package-install pkg))))

;; Enable plugin
(require 'company-english-helper)

;; damacs-packages end
(provide 'damacs-packages)
